<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Command Grammars</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Command Grammars' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">runtime</a></li><li><a href="index.html#7">Chapter 7: Command Grammar</a></li><li><b>Command Grammars</b></li></ul></div>
<p class="purpose">Runtime support for CGs.</p>

<ul class="toc"><li><a href="7-cg.html#SP1">&#167;1. Generic constants</a></li><li><a href="7-cg.html#SP4">&#167;4. Compilation data</a></li><li><a href="7-cg.html#SP9">&#167;9. Queued compilation</a></li><li><a href="7-cg.html#SP10">&#167;10. Compiling CG_IS_TOKEN grammars</a></li><li><a href="7-cg.html#SP11">&#167;11. Compiling CG_IS_COMMAND grammars</a></li><li><a href="7-cg.html#SP12">&#167;12. Compiling CG_IS_CONSULT grammars</a></li><li><a href="7-cg.html#SP13">&#167;13. Compiling CG_IS_PROPERTY grammars</a></li><li><a href="7-cg.html#SP14">&#167;14. Compiling CG_IS_VALUE grammars</a></li><li><a href="7-cg.html#SP15">&#167;15. Compiling CG_IS_SUBJECT grammars</a></li><li><a href="7-cg.html#SP16">&#167;16. Compiling all grammars</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Generic constants.</b>Here, <span class="extract"><span class="extract-syntax">REPARSE_CODE</span></span> is a magic value used in <a href="../CommandParserKit/index.html" class="internal">CommandParserKit</a> to
signal that some code which ought to have been parsing a command has in
fact rewritten it, so that the whole command must be re-parsed afresh.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_generic_constants</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::compile_generic_constants</span></span>:<br/>Generic Module - <a href="3-gm.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Task::vm</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TargetVMs::is_16_bit</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">REPARSE_CODE_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">10000</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">REPARSE_CODE_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">0x40000000</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_META_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_NOUN_FILTER_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_SCOPE_FILTER_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_REVERSE_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_SLASH_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_DIVIDER_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_RESULT_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_SPECIAL_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_NUMBER_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_NOUN_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">5</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTI_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">6</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIINSIDE_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">7</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIHELD_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">8</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_HELD_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">9</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_CREATURE_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">10</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_TOPIC_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">11</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIEXCEPT_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">12</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>This one is compiled later, since it depends (potentially) on a use option:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_non_generic_constants</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">DICT_WORD_SIZE_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">global_compilation_settings</span><span class="plain-syntax">.</span><span class="identifier-syntax">dictionary_resolution</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TargetVMs::is_16_bit</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::vm</span><span class="plain-syntax">()))</span>
<span class="plain-syntax">        </span><a href="7-cg.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></a><span class="plain-syntax">(</span><span class="constant-syntax">DICT_ENTRY_BYTES_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">8</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::iname_for_I6_parser_token</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::iname_for_I6_parser_token</span></span>:<br/>Command Grammar Tokens - <a href="7-cgt.html#SP1_3">&#167;1.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgt</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgt</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">grammar_token_code</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOUN_TOKEN_GTC:</span><span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_NOUN_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTI_TOKEN_GTC:</span><span class="plain-syntax">       </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTI_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIINSIDE_TOKEN_GTC:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIINSIDE_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIHELD_TOKEN_GTC:</span><span class="plain-syntax">   </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIHELD_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">HELD_TOKEN_GTC:</span><span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_HELD_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CREATURE_TOKEN_GTC:</span><span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_CREATURE_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOPIC_TOKEN_GTC:</span><span class="plain-syntax">       </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_TOPIC_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">MULTIEXCEPT_TOKEN_GTC:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_MULTIEXCEPT_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"tried to find inter name for invalid GTC"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> to prevent a compiler error: never reached</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::grammar_constant</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::grammar_constant</span></span>:<br/><a href="7-cg.html#SP1">&#167;1</a>, <a href="7-cg.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::numeric_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">, (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">V</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-hrr.html#SP17" class="function-link"><span class="function-syntax">Hierarchy::make_available</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Compilation data.</b>Each <span class="extract"><span class="extract-syntax">command_grammar</span></span> object contains this data:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">cg_compilation_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg_package</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg_token_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">CG_IS_TOKEN</span></span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">property_GPR_fn_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> CG_IS_PROPERTY_NAME</span><span class="extract"></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">CG_IS_TOKEN_identifier</span><span class="plain-syntax">; </span><span class="comment-syntax"> CG_IS_PROPERTY_NAME</span><span class="extract"></span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">consult_fn_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> CG_IS_CONSULT</span><span class="extract"></span>
<span class="plain-syntax">} </span><span class="reserved-syntax">cg_compilation_data</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">cg_compilation_data</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::new_compilation_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">cg_compilation_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">.</span><span class="element-syntax">cg_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">.</span><span class="element-syntax">consult_fn_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">.</span><span class="element-syntax">property_GPR_fn_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">.</span><span class="element-syntax">CG_IS_TOKEN_identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cgcd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure cg_compilation_data is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>In fact, however, only four of the six CG types live in their own packages,
so the following is not used for <span class="extract"><span class="extract-syntax">CG_IS_VALUE</span></span> or <span class="extract"><span class="extract-syntax">CG_IS_SUBJECT</span></span> grammars.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::package</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::package</span></span>:<br/><a href="7-cg.html#SP6">&#167;6</a>, <a href="7-cg.html#SP7">&#167;7</a>, <a href="7-cg.html#SP8">&#167;8</a>, <a href="7-cg.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_package</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_package</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP20" class="function-link"><span class="function-syntax">Hierarchy::completion_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">COMMAND_GRAMMARS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_package</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b><span class="extract"><span class="extract-syntax">CG_IS_PROPERTY_NAME</span></span> packages contain a function to match the value of
that property:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::get_property_GPR_fn_iname</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::get_property_GPR_fn_iname</span></span>:<br/><a href="7-cg.html#SP13">&#167;13</a><br/>Parse Name Properties - <a href="7-pnp.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_PROPERTY_NAME</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"prn_iname unavailable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">property_GPR_fn_iname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">property_GPR_fn_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PROPERTY_GPR_FN_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="7-cg.html#SP5" class="function-link"><span class="function-syntax">RTCommandGrammars::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">property_GPR_fn_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b><span class="extract"><span class="extract-syntax">CG_IS_TOKEN</span></span> packages contain a function to match that token. Note that these
can be translated in order to have a particular identifier.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::get_cg_token_iname</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::get_cg_token_iname</span></span>:<br/><a href="7-cg.html#SP10">&#167;10</a><br/>Command Grammar Tokens - <a href="7-cgt.html#SP1_5">&#167;1.5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"cg_token_iname unavailable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">CG_IS_TOKEN_identifier</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HierarchyLocations::find_by_name</span><span class="plain-syntax">(</span><a href="2-emt.html#SP1" class="function-link"><span class="function-syntax">Emit::tree</span></a><span class="plain-syntax">(),</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">CG_IS_TOKEN_identifier</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PARSE_LINE_FN_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><a href="7-cg.html#SP5" class="function-link"><span class="function-syntax">RTCommandGrammars::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::set_CG_IS_TOKEN_identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cg_token_iname</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"too late to translate"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">CG_IS_TOKEN_identifier</span><span class="plain-syntax">, </span><span class="string-syntax">"%N"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">));</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b><span class="extract"><span class="extract-syntax">CG_IS_CONSULT</span></span> packages contain a function which matches a snippet:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammars::get_consult_fn_iname</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::get_consult_fn_iname</span></span>:<br/><a href="7-cg.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_CONSULT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"cg_token_iname unavailable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">consult_fn_iname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">consult_fn_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CONSULT_FN_HL</span><span class="plain-syntax">, </span><a href="7-cg.html#SP5" class="function-link"><span class="function-syntax">RTCommandGrammars::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">consult_fn_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Queued compilation.</b>As noted above, not all types of command grammar have their own packages. For
those which do, we queue compilation requests with suitable agents.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_all</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"command grammar for token"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Sequence::queue_at</span><span class="plain-syntax">(&amp;</span><a href="7-cg.html#SP10" class="function-link"><span class="function-syntax">RTCommandGrammars::token_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">STORE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"command grammar for command '%W'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Sequence::queue_at</span><span class="plain-syntax">(&amp;</span><a href="7-cg.html#SP11" class="function-link"><span class="function-syntax">RTCommandGrammars::command_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">STORE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_CONSULT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"command grammar for consult at '%W'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Sequence::queue_at</span><span class="plain-syntax">(&amp;</span><a href="7-cg.html#SP12" class="function-link"><span class="function-syntax">RTCommandGrammars::consult_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">STORE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_PROPERTY_NAME</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"command grammar for property '%W'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">prn_understood</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Sequence::queue_at</span><span class="plain-syntax">(&amp;</span><a href="7-cg.html#SP13" class="function-link"><span class="function-syntax">RTCommandGrammars::property_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">STORE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Compiling CG_IS_TOKEN grammars.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::token_agent</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::token_agent</span></span>:<br/><a href="7-cg.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::list_length</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling command grammar $G\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> </span><span class="identifier-syntax">kit</span><span class="plain-syntax"> = </span><a href="2-gpr.html#SP3" class="function-link"><span class="function-syntax">GPRs::new_kit</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="7-cg.html#SP7" class="function-link"><span class="function-syntax">RTCommandGrammars::get_cg_token_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_original_var</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_standard_vars</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Compiling CG_IS_COMMAND grammars.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::command_agent</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::command_agent</span></span>:<br/><a href="7-cg.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::list_length</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling command grammar $G\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PR</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP20" class="function-link"><span class="function-syntax">Hierarchy::completion_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">COMMANDS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">array_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DECLARATION_ARRAY_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">PR</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><a href="2-ea.html#SP2" class="function-link"><span class="function-syntax">EmitArrays::begin_verb</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">array_iname</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::dword_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"no.verb"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">, </span><span class="string-syntax">"%N"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::dword_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;cg-&gt;</span><span class="identifier-syntax">no_aliased_commands</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">, </span><span class="string-syntax">"%N"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">aliased_command</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">            </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::dword_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">WD</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ea.html#SP5" class="function-link"><span class="function-syntax">EmitArrays::end</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::numeric_constant</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">NO_VERB_VERB_DEFINED_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">PR</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Compiling CG_IS_CONSULT grammars.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::consult_agent</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::consult_agent</span></span>:<br/><a href="7-cg.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::list_length</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling command grammar $G\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> </span><span class="identifier-syntax">kit</span><span class="plain-syntax"> = </span><a href="2-gpr.html#SP3" class="function-link"><span class="function-syntax">GPRs::new_kit</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="7-cg.html#SP8" class="function-link"><span class="function-syntax">RTCommandGrammars::get_consult_fn_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_range_vars</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_original_var</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_standard_vars</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">range_from_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Compiling CG_IS_PROPERTY grammars.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::property_agent</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::property_agent</span></span>:<br/><a href="7-cg.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::list_length</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling command grammar $G\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> </span><span class="identifier-syntax">kit</span><span class="plain-syntax"> = </span><a href="2-gpr.html#SP3" class="function-link"><span class="function-syntax">GPRs::new_kit</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="7-cg.html#SP6" class="function-link"><span class="function-syntax">RTCommandGrammars::get_property_GPR_fn_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_original_var</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_standard_vars</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Compiling CG_IS_VALUE grammars.</b>These are not compiled into their own packages, but into the body of GPRs
to parse values of given kinds. So the following assumes that we are already
in the middle of a GPR being compiled.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_for_value_GPR</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::compile_for_value_GPR</span></span>:<br/>Kind GPRs - <a href="7-kg.html#SP1_1">&#167;1.1</a>, <a href="7-kg.html#SP4_2">&#167;4.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_VALUE</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"not CG_IS_VALUE"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::list_length</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling command grammar $G\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. Compiling CG_IS_SUBJECT grammars.</b>Again, these are not compiled into their own packages, but into the body of
GPRs: in fact, they will be functions used as <span class="extract"><span class="extract-syntax">parse_name</span></span> property values.
</p>

<p class="commentary">Each CG_IS_SUBJECT grammar is attached to an inference subject, and when we
compile them we recurse up the subject hierarchy: thus if the red ball is of
kind ball which is of kind thing, then the <span class="extract"><span class="extract-syntax">parse_name</span></span> for the red ball
consists of grammar lines specified for the red ball, then those specified for
all balls, and lastly those specified for all things.
</p>

<p class="commentary">The order of these is important: by getting in first, grammar for the instance
takes priority; its immediate kind has next priority, and so on up the
hierarchy.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_for_subject_GPR</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::compile_for_subject_GPR</span></span>:<br/>Parse Name Properties - <a href="7-pnp.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_SUBJECT</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"not CG_IS_SUBJECT"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">subj_understood</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PARSING_DATA_FOR_SUBJ</span><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">)-&gt;</span><span class="identifier-syntax">understand_as_this_subject</span><span class="plain-syntax"> != </span><span class="identifier-syntax">cg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"link between subject and CG broken"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Parse_name content for $j:\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PARSING_DATA_FOR_SUBJ</span><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">)-&gt;</span><span class="identifier-syntax">understand_as_this_subject</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">infs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InferenceSubjects::narrowest_broader_subject</span><span class="plain-syntax">(</span><span class="identifier-syntax">subj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">infs</span><span class="plain-syntax">; </span><span class="identifier-syntax">infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InferenceSubjects::narrowest_broader_subject</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PARSING_DATA_FOR_SUBJ</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PARSING_DATA_FOR_SUBJ</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">)-&gt;</span><span class="identifier-syntax">understand_as_this_subject</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"And parse_name content inherited from $j:\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">infs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="7-cg.html#SP16" class="function-link"><span class="function-syntax">RTCommandGrammars::compile_general</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">PARSING_DATA_FOR_SUBJ</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">)-&gt;</span><span class="identifier-syntax">understand_as_this_subject</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Compiling all grammars.</b>And so all of the above functions ultimately funnel down to this one.
</p>

<p class="commentary">At this level we compile the list of CGLs in sorted order: this is what the
sorting was all for. In certain cases, we skip any CGLs marked as "one word":
these are cases arising from, e.g., "Understand "frog" as the toad.",
where we noticed that the CGL was a single word and included it in the <span class="extract"><span class="extract-syntax">name</span></span>
property instead. This is faster and more flexible, besides writing tidier
code.
</p>

<p class="commentary">The need for this is not immediately obvious. After all, shouldn't we have
simply deleted the CGL in the first place, rather than leaving it in but
marking it? The answer is no, because of the way inheritance works differently
for the <span class="extract"><span class="extract-syntax">name</span></span> property as opposed to <span class="extract"><span class="extract-syntax">parse_name</span></span> functions.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammars::compile_general</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammars::compile_general</span></span>:<br/><a href="7-cg.html#SP10">&#167;10</a>, <a href="7-cg.html#SP11">&#167;11</a>, <a href="7-cg.html#SP12">&#167;12</a>, <a href="7-cg.html#SP13">&#167;13</a>, <a href="7-cg.html#SP14">&#167;14</a>, <a href="7-cg.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="7-cgl.html#SP4" class="function-link"><span class="function-syntax">RTCommandGrammarLines::list_assert_ownership</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CommandGrammars::sort_command_grammar</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_SORTED_CG_LINES</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">suppress_compilation</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="7-cgl.html#SP6" class="function-link"><span class="function-syntax">RTCommandGrammarLines::compile_cg_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">CommandGrammars::cg_is_genuinely_verbal</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="7-cg.html#SP5" class="function-link"><span class="function-syntax">RTCommandGrammars::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_COMMAND_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_TOKEN_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_SUBJECT</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_SUBJECT_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_VALUE</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_VALUE_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_CONSULT</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_CONSULT_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_PROPERTY_NAME</span><span class="plain-syntax">) </span><span class="identifier-syntax">hl</span><span class="plain-syntax"> = </span><span class="constant-syntax">CG_IS_PROPERTY_NAME_MD_HL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">hl</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">hl</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_AT_MD_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_cg_created</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_raw_wording</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_NAME_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">token_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_wording</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_COMMAND_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">command</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;cg-&gt;</span><span class="identifier-syntax">no_aliased_commands</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">alias</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP21" class="function-link"><span class="function-syntax">Hierarchy::package_within</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CG_COMMAND_ALIASES_HAP</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_wording</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">alias</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_ALIAS_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">aliased_command</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_SORTED_CG_LINES</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">belongs_to_cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP21" class="function-link"><span class="function-syntax">Hierarchy::package_within</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CG_LINES_HAP</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">metadata_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">xref_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CG_XREF_SYMBOL_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">line</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::numeric_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">xref_iname</span><span class="plain-syntax">, </span><span class="constant-syntax">561</span><span class="plain-syntax">);</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resulting_action</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP21" class="function-link"><span class="function-syntax">Hierarchy::package_within</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CG_LINES_PRODUCING_HAP</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><a href="5-act2.html#SP2" class="function-link"><span class="function-syntax">RTActions::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resulting_action</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_LINE_PRODUCING_MD_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">xref_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">VW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CommandGrammars::get_verb_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">belongs_to_cg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resulting_action</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_ACTION_MD_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><a href="5-act2.html#SP6" class="function-link"><span class="function-syntax">RTActions::double_sharp</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resulting_action</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">VW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_wording</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_TRUE_VERB_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">VW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="string-syntax">"%w"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Lexer::word_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">original_text</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_LINE_TEXT_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_LINE_AT_MD_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">original_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">reversed</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="constant-syntax">CG_LINE_REVERSED_MD_HL</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="6-inf.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-rm.html">1</a></li><li class="progresschapter"><a href="2-hrr.html">2</a></li><li class="progresschapter"><a href="3-gm.html">3</a></li><li class="progresschapter"><a href="4-enc.html">4</a></li><li class="progresschapter"><a href="5-act.html">5</a></li><li class="progresschapter"><a href="6-bd.html">6</a></li><li class="progresscurrentchapter">7</li><li class="progresscurrent">cg</li><li class="progresssection"><a href="7-cgl.html">cgl</a></li><li class="progresssection"><a href="7-cgt.html">cgt</a></li><li class="progresssection"><a href="7-kg.html">kg</a></li><li class="progresssection"><a href="7-nft.html">nft</a></li><li class="progresssection"><a href="7-np.html">np</a></li><li class="progresssection"><a href="7-pnp.html">pnp</a></li><li class="progressnext"><a href="7-cgl.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

